import { createRouter, createWebHistory } from 'vue-router'

export default createRouter({
    history: createWebHistory(),
    // 滚动行为
    scrollBehavior() {
        return {
            top: 0,
            left: 0
        }
    },
    routes: [
        {
            path: '/login',
            name: 'login',
            component: () => import('@/views/Login/index.vue')
        },
        {
            path: '/register',
            name: 'register',
            component: () => import('@/views/Register/index.vue')
        },
        {
            path: '/',
            component: () => import('@/views/Layout/index.vue'),
            redirect: '/message',
            children: [
                {
                    path: 'message',
                    name: 'message',
                    component: () => import('@/views/Layout/Message/index.vue'),
                    meta: {
                        isLogin: true
                    }
                },
                {
                    path: 'contact',
                    name: 'contact',
                    component: () => import('@/views/Layout/Contact/index.vue'),
                    meta: {
                        isLogin: true
                    }
                },
                {
                    path: 'space',
                    name: 'space',
                    component: () => import('@/views/Layout/Space/index.vue'),
                    meta: {
                        isLogin: true
                    }
                },
                {
                    path: 'notes',
                    name: 'notes',
                    component: () => import('@/views/Layout/Notes/index.vue'),
                    meta: {
                        isLogin: true
                    }
                }
            ]
        }
    ]
})